package com.system.comm.util;


public class RandomUtil {

	private static char mapTable[] = {
            '0', '1', '2', '3', '4', '5',
            '6', '7', '8', '9', '0', '1',
            '2', '3', '4', '5', '6', '7',
            '8', '9'};
	
	public static String randomString(int length) {
		return randomStringWithMap(length,mapTable);
	}
	
	public static String randomStringWithMap(int length,char[] chars) {
        
        String strEnsure = "";
        for (int i = 0; i < length; ++i) {
            strEnsure += chars[(int) (chars.length * Math.random())];
        }
		return strEnsure;
	}
}
